import React, { Component } from 'react'
import {
	Text, View
} from "react-native";
import { SpaceBetween } from '../../../create/_components/SpaceBetween.js';
import { styles } from '../../_common/style';

//基本信息
export class QHSaleBaseSection extends Component {
	constructor(props) {
		super(props);
	};

	componentDidMount () {
	}

	render () {
		const { data, title, baseInfoType, choice } = this.props;
		const { companyName, orderId, baseDateSettleName, orderType, bizStaffName, bizTeamName, bizOrganName, purchaseDeliveryTypeName,
			saleDeliveryTypeName, orderItemList } = data;
		const { priceFormulaDesc } = orderItemList[0];
		return (
			<View style={[styles.itemBox, baseInfoType === 'S' ? styles.borders : {}]}>
				<Text style={styles.itemTitle}>{title ? title : '基本信息'}</Text>
				<SpaceBetween fontLeft={{ title: '订单编号' }} fontRight={{ title: orderId }} />
				<SpaceBetween fontLeft={{ title: orderType === 'S' ? '客户' : '供应商' }} fontRight={{ title: companyName }} />
				<SpaceBetween fontLeft={{ title: '业务组织' }} fontRight={{ title: choice.corpName || '-' }} />
				<SpaceBetween fontLeft={{ title: '申请人' }} fontRight={{ title: bizStaffName }} />
				<SpaceBetween fontLeft={{ title: '结算价格公式' }} fontRight={{ title: priceFormulaDesc || '-' }} />
				<SpaceBetween fontLeft={{ title: '结算基准日期' }} fontRight={{ title: baseDateSettleName || '-' }} />
				<SpaceBetween fontLeft={{ title: '交货方式' }} fontRight={{ title: orderType === 'P' ? purchaseDeliveryTypeName : saleDeliveryTypeName || '-' }} />
				<Text style={styles.itemNameBranch}>
					{(bizStaffName || bizTeamName || bizOrganName) ? `(${bizStaffName || '-'} | ${bizTeamName || '--'} | ${bizOrganName || '-'})` : '--'}
				</Text>
			</View>
		)
	}
}